package com.wb.mas.ui.refund;


import android.content.Intent;
import android.os.Bundle;

import androidx.lifecycle.ViewModelProviders;

import com.wb.mas.R;
import com.wb.mas.app.AppViewModelFactory;
import com.wb.mas.databinding.ActRefundBinding;

import me.goldze.mvvmhabit.BR;
import me.goldze.mvvmhabit.base.BaseActivity;
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter;

/**
 * Copyright (C) 2018,
 * OrderActivity
 * <p>
 * Description
 * 还款
 *
 * @author yue
 * @version 1.0
 * <p>
 * Ver 1.0, 2019-04-30, yue, Create file
 */
public class RefundActivity extends BaseActivity<ActRefundBinding, RefundViewModel> {

    public static final int TYPE_REFUND = 1;
    public static final int TYPE_DEFER = 2;
    public String orderId;

    public String approvedAmt;

    public int type;

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.act_refund;
    }

    @Override
    public void initParam() {
        super.initParam();
        Intent intent = getIntent();
        orderId = intent.getStringExtra("orderId");
        approvedAmt = intent.getStringExtra("approvedAmt");
        type=intent.getIntExtra("type",TYPE_REFUND);
    }

    @Override
    public RefundViewModel initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        RefundViewModel refundViewModel = ViewModelProviders.of(this, factory).get(RefundViewModel.class);
        refundViewModel.orderId = orderId;
        refundViewModel.approvedAmt = approvedAmt;
        refundViewModel.type = type;
        return refundViewModel;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        binding.setAdapter(new BindingRecyclerViewAdapter());
    }


}
